<?php
/**
 * 用户
 * 
 * Created	: 2010-11-08
 * Modified : 2010-11-08
 * @author  : 陈立强
 */
class SFriend extends Friend
{
	
	/**
	 * 获取好友信息
	 * @param int $uid
	 * @param int $friend_id
	 */
	public static function getInfo($uid, $friend_id)
	{
		global $L;
		$friend_id = (int)$friend_id;
		$info = parent::getInfo($uid, $friend_id);
		if ($info) {
			return array(
				'val' => true,
				'data' => array(
					'nickname' => $info['nickname'],
					'lvl' => $info['lvl'],
					'friend_val' => parent::getFriendlyVal($uid, $friend_id),
				)
			);
		} else {
			return array(
				'val' => false,
				'msg' => $L['Failure']
			);
		}
	}
	
	/**
	 * 根据玩家昵称取信息
	 * @param int $uid
	 * @param int $nickname
	 */
	public static function getInfoByName($uid, $nickname)
	{
		global $L;
		$info = parent::getInfoByName($uid, $nickname);
		if ($info) {
			return array(
				'val' => true,
				'data' => array(
					'nickname' => $info['nickname'],
					'lvl' => $info['lvl'],
					'friend_val' => parent::getFriendlyVal($uid, $friend_id),
				)
			);
		} else {
			return array(
				'val' => false,
				'msg' => $L['Failure']
			);
		}
	}

	
	/**
	 * 获取好友列表
	 * @param int $uid
	 * @param int|null $status 参数:null-所有好友(含未确认),0-未确认好友,1-已确认好友
	 */
	public static function getList($uid, $status=null)
	{
		$list = parent::getList($uid, $status);
		
		return array(
			'val' => true,
			'data' => $list
		);
	}
}